package com.hanvon.paycheck;

import com.hanvon.paycheck.view.*;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.GridView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.support.v4.app.NavUtils;

public class PaySignatureCheck extends Activity {

	StrokeView mStrokeView = null;
	RelativeLayout rLayout=null;
	public RadioButton rbL=null;
	public RadioButton rbC=null;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pay_signature_check);
        
		if(mStrokeView == null)
		{
			mStrokeView=new StrokeView(this,700,400);
			mStrokeView.mainActivty=this;
		}
		final RelativeLayout.LayoutParams rlp1=new RelativeLayout.LayoutParams(700, 400);
		rLayout=(RelativeLayout)findViewById(R.id.sview);
		rLayout.addView(mStrokeView, rlp1);
		rbL=(RadioButton)findViewById(R.id.learnSignature);
		rbC=(RadioButton)findViewById(R.id.checkSignature);
		
		RadioGroup rg=(RadioGroup)findViewById(R.id.IsCheckSign);
		rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
			
			@Override
			public void onCheckedChanged(RadioGroup group, int checkedId) {
				// TODO Auto-generated method stub
				if (checkedId==rbC.getId()) {
					mStrokeView.isCheck=true;
				}
				else {
					mStrokeView.isCheck=false;
					mStrokeView.template=null;
					mStrokeView.numOfTempalte=0;
				}
			}
		});
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_pay_signature_check, menu);
        return true;
    }

    @Override
    protected void onDestroy() {
    	//HwPaint.destroy();
    	super.onDestroy();

    	if(mStrokeView!=null)
    		mStrokeView.Destroy();
    	mStrokeView = null;
    }
}
